package com.hdj.chapter1.demo1;

/**
 * 建工厂类</br>
 *
 * @author hedajiang
 * @create 2017/12/12
 * @since 1.0.0
 */
public class SendFactory {
    private com.hdj.chapter1.demo1.Sender sender = null;
    public com.hdj.chapter1.demo1.Sender produce(String senderType){
        if(senderType==null || "".equals(senderType)){
            return null;
        }
        switch (senderType){
            case "sms" :
                sender = new com.hdj.chapter1.demo1.SmsSender();
                break;
            case "mail":
                sender = new com.hdj.chapter1.demo1.MailSender();
                break;
            default: sender = null;
                break;
        }
        return sender;
    }

}